<%@ page import="java.util.Map" %>
<%@ page import="java.util.List" %>
<%@ page import="com.resataurant.Entity.Dish" %>
<%@ page import="com.resataurant.Service.AdminService" %>
<%@ page import="com.resataurant.Service.Impl.AdminServiceImpl" %>
<%@ page import="com.resataurant.Service.UserService" %>
<%@ page import="com.resataurant.Service.Impl.UserServiceImpl" %>


<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>餐厅管理系统登录解密</title>
    <!-- 新 Bootstrap 核心 CSS 文件 -->
    <link href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">

    <!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
    <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>

</head>
<body style="background: beige">
<div class="container">
    <div class="row clearfix">
        <div class="col-md-12 column">
            <div class="row clearfix">

                <%
                    UserService userService=new UserServiceImpl();
                    String id= request.getParameter("id");//用ID去查商品
                    if(id==null){
                        id=(String) request.getSession().getAttribute("id");
                    }
                    Dish dish=null;
                    if(id==null){
                        dish= new Dish("","","","","","");
                    }else{
                        dish = userService.searchDishById(id);
                    }
                    request.getSession().removeAttribute("id");
                %>


                <div class="col-md-4 column">
                    <img style="width: 300px;height: 200px" alt="300x200" src="<%=dish.getDishImage()%>"/>
                </div>
                <div class="col-md-4 column">
                    <form class="form-horizontal" role="form" method="get"  enctype="multipart/form-data" action="${pageContext.request.contextPath}/BuyDishServlet">
                        <div class="form-group">
                            <label class="col-sm-2 control-label">商品名字</label>
                            <div class="col-sm-10">
                                <p><%=dish.getDishName()%></p>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label">商品内容</label>
                            <div class="col-sm-10">
                                <p><%=dish.getDishContent()%></p>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label">商品价格</label>
                            <div class="col-sm-10">
                                <p><%=dish.getDishPrice()%></p>
                            </div>
                        </div>

                        <div class="form-group">
                            <label for="inputEmail6" class="col-sm-2 control-label">备注</label>
                            <div class="col-sm-10">
                                <input type="text" name="UserNote" class="form-control" id="inputEmail6" placeholder="无" value="无" />
                            </div>
                        </div>


                        <div class="form-group">
                            <div class="col-sm-offset-2 col-sm-10">
                                <input type="hidden" name="id" value="<%=dish.getDishId()%>">
                                <button type="submit" class="btn btn-default">购买餐品</button>
                                <button class="btn btn-default"><a href="${pageContext.request.contextPath}/user.jsp" >返回到上一页</a></button>
                            </div>
                        </div>
                        <label>${message}</label>
                        <%request.getSession().removeAttribute("message");%>
                    </form>
                </div>
                <div class="col-md-4 column">
                </div>
            </div>
        </div>
    </div>
</div>

</body>
</html>
